/**
 * 功能描述
 */

define(function (require, exports, module) {
	var Component = require("grid");
	var proctrgrid = require("../constant/fetchProperties");
    var instance = {
        initComponent: function (params, widget) {
            var component = new Component({
            	parentNode : ".J-grid",	
            	url : "api/roomstatistics/queryroomsum",
            	autoRender : false,
				params : function(){
					var subnav = widget.get("subnav");
					var obj = {
                			"servicePoint" : subnav.getValue("servicePoint"),
                			"checkInDate" :  subnav.getValue("createDate"),
                			"checkOutDate" : subnav.getValue("createDate") + 1000*60*60*24,
                			fetchProperties : proctrgrid.fetchProperties
                	};
	    			return obj;
				},
				model : {
				 columns  : [{
					 name : "roomX",//
					 label : "房型",
				 },{
					 name : "sumRoom",
					 label : "总房数",
				 },{
					 name : "xRoom",
					 label : "维修房",
				 },{
					 name : "kRoom",
					 label : "可售房",
				 },{
					 name : "sRoom",
					 label : "散客住房",
				 },{
					 name : "tRoom",
					 label : "团体住房",
				 },{
					 name : "syRoom",
					 label : "散客预订",
				 },{
					 name : "tyRoom",
					 label : "团体预订",
				 },{
					 name : "hRoom",
					 label : "合计用房(不含将离)",
					 format : function(value, row){
						 if(value < 0){
							 return 0;
						 }  else {
							 return value;
						 }
					 }
				 },{
					 name : "lRoom",
					 label : "将离房",
				 },{
					 name : "hyRoom",
					 label : "合计使用房",
				 },{
					 name : "syhRoom",
					 label : "剩余房(含维修房)",
				 },{
					 name : "sybRoom",
					 label : "剩余房(不含维修房)",
				 }]
				}
            });
            widget.set("grid", component);
        }
    };
    module.exports = instance;
});
